﻿@model CandidateManager.Areas.Coach.Models.OccurrenceModifyModel

@{
    ViewBag.Title = @Resources.Coach.CoachManageOccurrence;
}

<h2>@Resources.Coach.CoachManageOccurrence</h2>

<script type="text/javascript">
    $(document).ready(function () {
        $('.time').timepicker();
    });
</script>

@if (Model.Occurrence.Id > 0)
{
    <p>
        @Html.ActionLink(@Resources.Coach.CoachCreateOccurrenceResult, "Create", "OccurrenceResult", new { @class = "common-btn BlueColor" })
    </p>
}

@using (Html.BeginForm())
{
    <table class="bordered">
        <tr>
            <td class="vertical-header">@Resources.Coach.CoachSubjectName</td>
            <td>@Html.DisplayFor(m => m.Schedule.Subject.Name)</td>
        </tr>
        <tr>
            <td class="vertical-header">@Resources.Coach.CoachGroupName</td>
            <td>@Html.DisplayFor(m => m.Schedule.StudyGroup.GroupName)</td>
        </tr>
        <tr>
            <td class="vertical-header">@Resources.Coach.CoachOccurrenceFrom</td>
            <td>@Html.TextBoxFor(m => m.Occurrence.From,"{0:HH:mm}", new { @class = "time" })</td>
        </tr>
        <tr>
            <td class="vertical-header">@Resources.Coach.CoachOccurrenceTo</td>
            <td>@Html.TextBoxFor(m => m.Occurrence.To, "{0:HH:mm}", new { @class = "time" })</td>
        </tr>
    </table>
    
    <p>
        @Html.ActionLink(@Resources.Coach.CoachBackButton, "List", "Schedule", new { @class = "common-btn-large BlueColor" })
        <input class="common-btn-large BlueColor" type="submit" value="@Resources.Coach.CoachSubmitButton">
    </p>
    @Html.ValidationSummary(true)
    @Html.HiddenFor(m => m.Schedule.SubjectId);
    @Html.HiddenFor(m => m.Schedule.StudyGroupId);
    @Html.HiddenFor(m => m.Occurrence.Id);
}


<h2>@Resources.Coach.CoachOccurrenceList</h2>

<table class="bordered">
    <thead>
        <tr>
            <th class="Center column-detail">@Resources.Coach.CoachEdit</th>
            <th class="vertical-header">@Resources.Coach.CoachOccurrenceFrom</th>
            <th class="vertical-header">@Resources.Coach.CoachOccurrenceTo</th>
            <th class="vertical-header">@Resources.Coach.CoachStartDate</th>
            <th class="vertical-header">@Resources.Coach.CoachEndDate</th>
            <th class="Center column-detail">@Resources.Coach.CoachDelete</th>
        </tr>
    </thead>

    @foreach (var occurrence in Model.Occurrences)
    {
        <tr>
            <td class="Center column-detail">@Html.ActionLink(@Resources.Coach.CoachEdit, "Create", "Occurrence", new { @subjectId = occurrence.Schedule.SubjectId, @groupId = occurrence.Schedule.StudyGroupId, @occurrenceId = occurrence.Id }, new { @class = "common-btn BlueColor" })</td>
            <td>@occurrence.From.ToString("HH:mm")</td>
            <td>@occurrence.To.ToString("HH:mm")</td>
            <td>@Html.Label(occurrence.Schedule.StartDate.ToString("MM/dd/yyyy"))</td>
            <td>@Html.Label(occurrence.Schedule.EndDate.ToString("MM/dd/yyyy"))</td>
            <td class="Center column-detail">@Html.ActionLink(@Resources.Coach.CoachDelete, "Delete", "Occurrence", new { @occurrenceId = occurrence.Id }, new { @class = "common-btn RedColor" })</td>
        </tr>
    }
</table>
